package functions;

import connection.*;

public class Autojoin implements IrcFunction {
	IrcConnection connection;
	String[] channels;
	
	public Autojoin() {
	}
	
	public void setIrcConnection(IrcConnection con) {
		connection = con;
		connection.addEventListener(this, "376");
	}
	
	public void setParams(String[] params) {
		channels = params;
	}
	
	public void eventPerformed(IrcEvent e) {
		for (String chan: channels) {
			connection.join(chan);
		}
	}
}
